import type { Address, OrderPre } from '@/types/order'
import request from '@/utils/request'

/**
 * 收货地址列表
 */
export const addressListApi = () => {
  return request.get<null, Address[]>('/patient/order/address')
}

/**
 * 药品预付订单
 * prescriptionId:处方Id
 */
export const preOrderApi = (prescriptionId: string) => {
  return request.get<null, OrderPre >('/patient/medicine/order/pre', { params: { prescriptionId } })
}


/** 创建一个药品订单 */
export const createOrderApi = (id: string, addressId: string) => {
  return request.post<any, { id: string }>('/patient/medicine/order', { id, addressId })
}